﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Account_AjaxContrls : System.Web.UI.Page
{
    DbHelper db = new DbHelper();
    MyDbHelper mydb = new MyDbHelper();
    protected void Page_Load(object sender, EventArgs e)
    {
        string aciton=Request.Params["aciton"];
        switch (aciton)
        {
            case "pos_sale_chart":
                GetPosSaleDate();
                break;
            case "get_modles":
                GetModules();
                break;
        }
        
    }
    
    private void GetModules()
    {
        string sql = "select * from sys_modules where parentid = 0";
        DataSet ds = mydb.DM_GetDateSet(sql);
        if (ds.Tables[0].Rows.Count > 0)
        {
            string sbr = "";
            sbr = "[";
            string child_sbr = "";
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                child_sbr = GetChildModules(dr["parentid"].ToString());
                sbr += "{\"text\":\"" + dr["modulename"]
                 + "\",\"href\":\"#" + dr["modulename"]
                 + "\",\"tags\":[\"" + dr["parentid"]
                 + "\"]},";
            }
            sbr = sbr.TrimEnd(',') + "]";
            Response.Write(sbr);
            Response.End();

        }
    }

    private string GetChildModules(string parentid)
    {
        return "";
    }


    private void GetPosSaleDate()
    {
    }
}